﻿/*
#------------------------------------------------------------------------------
#-- Program Name:	[dbo].[spMSX_get_servers_inventory_compare]
#-- Purpose:		Get a list of currently inventoried servers and their state
#--					to compare with a list of servers that were just discovered.
#--	Last Update:	07/28/2014
#--					For a complete history - please review comments in Version
#--					Control.
#------------------------------------------------------------------------------
*/
CREATE PROCEDURE [dbo].[spMSX_get_servers_inventory_compare]
AS

SET NOCOUNT ON


DECLARE @t TABLE (
	[ssd_server_name] varchar(60) NOT NULL,
	[ssd_sqlserver_name_ro] varchar(256) NOT NULL,
	[ssd_is_disabled] bit NOT NULL,
	[ssd_is_vendor_managed_ro] bit NOT NULL,
	[updated] bit NOT NULL DEFAULT(0)
	)

INSERT INTO @t
	SELECT		ssd.ssd_server_name,
				ssd.ssd_sqlserver_name_ro, 
				ssd.ssd_is_disabled,
				ssd.ssd_is_vendor_managed_ro,
				CAST(0 as bit) updated
	FROM		[dbo].[tblMSX_server_discovery] ssd
	LEFT JOIN	[dbo].[tblMSX_server_sql_info] sql ON ssd.ssd_id = sql.sql_ssd_id
	ORDER BY	ssd_sqlserver_name_ro

SELECT * FROM @t

SET NOCOUNT OFF